import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    cachePages: ['Home'],
  },
  mutations: {
    rmPage(state, page) {
      const idx = state.cachePages.indexOf(page)
      if (idx !== -1) state.cachePages.splice(idx, 1)
    },
    addPage(state, page) {
      if (!state.cachePages.includes(page)) state.cachePages.push(page)
    },
  },
})
